package com.xuxueli.crawler.util;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @author: zmh
 * @create: 18-10-11
 * @description: ${description}
 **/
public class JsonUtil {

    public static Map<String, String> getResultList(String content) {
        Map<String, String> maplist = new HashMap<String, String>();
        try {
            JSONObject jo = new JSONObject(content.replaceAll(",\\\"r\\\":false", ""));
            Iterator it = jo.keys();
            String key = "";
            String value = "";
            while (it.hasNext()) {
                key = (String) it.next();
                value = jo.getString(key);
                maplist.put(key, value);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return maplist;
    }
}
